Page 2 of 2 FirstFirst 12
Results 11 to 18 of 18

Thread: Weapon Check - Results in NULL Help

  1. #11
    Developer Sor's Avatar
    Join Date
    Aug 2010
    Location
    The Medieval City of Bruges
    Posts
    747

    Default

    Simply do this
    Code:
    local.weapon targetname ""
    Morpheus Script (MoH) => You try to shoot yourself in the foot only to discover that MorpheusScript already shot your foot for you.

  2. #12
    Purple Developer Purple Elephant1au's Avatar
    Join Date
    Feb 2012
    Location
    Australia
    Posts
    1,259

    Default

    local.weapon targetname ""

    Still resulting in script error

    Script Error: command 'targetname' applied to NIL

    Yea i dnt no the difference between NIL and NULL i read it somewhere but forget it or i didnt quite understand it

    Purple's Playground
    OBJ :
    103.29.85.127:12203
    xfire: purpleelephant1au
    email: purpleelephant1au@gmail.com
    skydrive: PurpleElephantSkydrive




  3. #13

    Default

    Taken from another forum....

    Assuming we're talking about Objetive-C:
    nil (all lower-case) is a null pointer to an Objective-C object.
    Nil (capitalized) is a null pointer to an Objective-C class.
    NULL (all caps) is a null pointer to anything else.

    So, conceptually, they mean the same thing but for different categories of things. They all have the same representation, too; they all happen to have the numeric value of 0.

  4. #14
    Developer Sor's Avatar
    Join Date
    Aug 2010
    Location
    The Medieval City of Bruges
    Posts
    747

    Default

    It means getactiveweap returned nothing.
    Morpheus Script (MoH) => You try to shoot yourself in the foot only to discover that MorpheusScript already shot your foot for you.

  5. #15
    Purple Developer Purple Elephant1au's Avatar
    Join Date
    Feb 2012
    Location
    Australia
    Posts
    1,259

    Default

    I should add Im using the

    local.player weaponcommand dual targetname ("weap" + local.player.entnum )
    local.player.weapon = $("weap" + local.player.entnum ).model

    Method to check weapon

    Purple's Playground
    OBJ :
    103.29.85.127:12203
    xfire: purpleelephant1au
    email: purpleelephant1au@gmail.com
    skydrive: PurpleElephantSkydrive




  6. #16
    Über Prodigy & Developer Razo[R]apiD's Avatar
    Join Date
    May 2010
    Location
    Poland, Lublin
    Posts
    3,245

    Default

    Actually it means there's nothing stored in local.weapon variable.

  7. #17
    Developer Sor's Avatar
    Join Date
    Aug 2010
    Location
    The Medieval City of Bruges
    Posts
    747

    Default

    It would be great if I actually knew what you were using at the occurrence of the error but try this:
    Code:
    while (local.player && !local.weapon) {
        local.player weaponcommand dual targetname ("weap" + local.player.entnum )
        local.weapon = $("weap" + local.player.entnum)
        waitframe
    }
    local.player.weapon = local.weapon.model
    local.player iprint ("am now holding weapon " + local.player.weapon)

    Last edited by Sor; November 25th, 2012 at 05:24 PM.
    Morpheus Script (MoH) => You try to shoot yourself in the foot only to discover that MorpheusScript already shot your foot for you.

  8. #18
    Purple Developer Purple Elephant1au's Avatar
    Join Date
    Feb 2012
    Location
    Australia
    Posts
    1,259

    Default

    Here is the weapon check part of it

    Code:
    ////////////////////////////////////////////////////////////
    ////////////// Weapon Check Part ///////////////////////////
    
    if(local.player != NULL && local.player != NIL && isAlive(local.player) && local.player.dmteam != spectator)
    
    {
    		local.player weaponcommand dual targetname ("weap" + local.player.entnum )
    		local.player.weapon = $("weap" + local.player.entnum ).model
    		
    		if(local.player.weapon != NIL && local.player.weapon != NULL)
    		
    		{
    				for (local.i = 1; local.i <= local.notallowed.size; local.i++) 
    				{
    					   if(local.player.weapon == local.notallowed[local.i])
    						{	
    								local.player take local.notallowed[local.i]
    								if(getcvar(pe_weapon_choice) != "1")
    								{ 
    								local.player give models/weapons/KAR98sniper.tik
    								local.player use models/weapons/KAR98sniper.tik
    								}
    								if(getcvar(pe_weapon_choice) == "1")
    								{
    								local.player spectator
    								local.player stufftext "pushmenu SelectPrimaryWeapon"
    								}
    								if(getcvar(pe_weapon_message) == "1") 
    												{
    													local.player iprint ("The Weapon you chose is unavailable") 1
    													local.player iprint (local.allowed) 1
    													//local.player iprint ("So here is a Sniper") 1	
    												}
    								
    								
    						}		
    					 
    								
    				}
    		}
    }
    local.notallowed is where the weapon models are stored which is altered via cvars , but that works . It all works i just dnt see why i need to add the
    local.player.weapon targetname ""

    EDIT :: Just tested it on my server will a few people and it works perfectly and producing same errors but still works fine
    Last edited by Purple Elephant1au; November 28th, 2012 at 04:27 AM.

    Purple's Playground
    OBJ :
    103.29.85.127:12203
    xfire: purpleelephant1au
    email: purpleelephant1au@gmail.com
    skydrive: PurpleElephantSkydrive




Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •